<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<script>
   var num1 = prompt("请输入一个数字:");
   var num2 = prompt("请输入另一个数字:");
   var sum = parseInt(num1) + parseInt(num2);
 if(num1 == '' || num2 == '' || isNaN(num1) || isNaN(num2)){
    alert("输入有误，请重新输入！");
 }else{
    alert(`两数之和为${sum}`);
}

</script>
<body>
    
</body>
</html>